package com.htu.controller;

import com.htu.po.DeliveryAddress;
import com.htu.service.DeliveryAddressService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

@Controller
@ResponseBody
@RequestMapping("/DeliveryAddressController")
public class DeliveryAddressController {
    @Autowired
    private DeliveryAddressService deliveryAddressService;
    @RequestMapping("/listDeliveryAddressByUserId")
    public List<DeliveryAddress> listDeliveryAddressByUserId(String userId){
        return deliveryAddressService.listDeliveryAddressByUserId(userId);
    }
    @RequestMapping("/removeDeliveryAddress")
    public int removeDeliveryAddress(Integer daId){
        return deliveryAddressService.removeDeliveryAddress(daId);
    }
     @RequestMapping("/getDeliveryAddressById")
    public DeliveryAddress getDeliveryAddressById(Integer daId){
        return deliveryAddressService.getDeliveryAddressById(daId);
    }
    @RequestMapping("/updateDeliveryAddress")
    public int updateDeliveryAddress (DeliveryAddress deliveryAddress){
        return deliveryAddressService.updateDeliveryAddress(deliveryAddress);
    }
    @RequestMapping("/saveDeliveryAddress")
    public int saveDeliveryAddress(DeliveryAddress deliveryAddress){
        return deliveryAddressService.saveDeliveryAddress(deliveryAddress);
    }
}
